<?php
  // Has an upload file been provided?
  if (isset($_FILES['attachement']) && !empty($_FILES['attachement']['name'])) {

    // Where the file is going to be placed 
    $target_path = "uploads/";

    // Add the original filename to our target path
    $target_path = $target_path . basename( $_FILES['attachement']['name']); 

    echo $target_path;

    if (move_uploaded_file($_FILES['attachement']['tmp_name'], $target_path)) {
      echo "The file ".  basename( $_FILES['attachement']['name']). 
      " has been uploaded";
    } else{
      echo "There was an error uploading the file, please try again!";
    }
  }
?>

<html>
  <body>
    
    <form enctype="multipart/form-data" action="upload.php" method="POST">
      <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
      <input name="attachement" type="file" /> <input type="submit" value="Upload File" />
    </form>

    <?php echo '<p>Hello World</p>'; ?>
  </body>
</html>
